import request from "@/plugins/axios";

/**
 * 分页預算等級記錄
 * @param searchKeyword
 * @param currentPage
 * @param pageSize
 */
export function searchBudgetSettlementReviewList(params) {
    return request({
        url: "/api/budget/settlement/review/page",
        method: "get",
        params: params
    });
}

/**
 * 添加预算登记
 * @param formData
 */
export function addSettlement(formData) {
    return request({
        url: "/api/budget/settlement/review",
        method: "post",
        data: formData
    });
}


/**
 * 通过id查询
 * @param formData
 */
export function getBudgetSettlementReviewById(id) {
    return request({
        url: "/api/budget/settlement/review/"+id,
        method: "get"
    });
}

/**
 * 更新预算登记
 * @param editObj
 */
export function updateSettlement(editObj) {
    return request({
        url: "/api/budget/settlement/review",
        method: "put",
        data: editObj
    });
}


/**
 * 删除预算结算登记
 * @param val
 */
export function deleteRowById(val) {
    return request({
        url: "/api/budget/settlement/review/" + val,
        method: "delete"
    });
}

/**
 * 获取当天最大编号
 * @param val
 */
export function getMaxSerialNo(costPriceType) {
    return request({
        url: "/api/budget/settlement/review/serialNo?costPriceType="+costPriceType,
        method: "get"
    });
}


/**
 * 新增时校验工程名称
 * @param value
 * @param costPriceType
 */
export function checkEngineeringName(value,costPriceType) {
    return request({
        url: "/api/budget/settlement/review/checkEngineeringNameByAdd?costPriceType="+costPriceType+"&engineeringName="+value,
        method: "get"
    });
}

/**
 * 修改是校验工程名称
 * @param value
 * @param costPriceType
 * @param id
 */
export function checkEngineeringNameByUpdate(value,costPriceType,id) {
    return request({
        url: "/api/budget/settlement/review/checkEngineeringNameByUpdate?costPriceType="+costPriceType+"&engineeringName="+value+"&seReId="+id,
        method: "get"
    });
}

/**
 * 导出预算结算登记
 * @param searchKeyword
 * @param currentPage
 * @param pageSize
 */
export function exportRegistration(params) {
    return request({
        url: "/api/budget/settlement/review/export",
        method: "get",
        params,
        responseType: "blob"
    });
}


/**
 * 导出预算结算登记表
 * @param searchKeyword
 * @param currentPage
 * @param pageSize
 */
export function exportWord(seReId,costPriceType) {
    return request({
        url: "/api/budget/settlement/review/download/budgetSettlement?seReId="+seReId+"&costPriceType="+costPriceType,
        method: "get",
        responseType: "blob"
    });
}
